<template>
  <div class="add-form-dialog">
    <a-select
      mode="multiple"
      allow-clear
      show-search
      placeholder="请选择表单"
      style="width: 98%"
      option-filter-prop="children"
      :filter-option="filterOption"
      v-model="formIds"
    >
      <a-select-option v-for="item in formList" :key="item.id" :value="item.id">
        {{item.name}}
      </a-select-option>
    </a-select>
  </div>
</template>

<script>
  import formService from '@/api/formService'
export default {
  name: 'addFormDialog',
  data () {
    return {
      formList: [],
      formIds: []
    }
  },
  mounted () {
    this.getFormList()
  },
  methods: {
    async getFormList () {
      const data = await formService.searchForm()
      this.formList = data.rows || []
    },
    filterOption (input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      )
    }
  }
}
</script>

<style lang="less" scoped>

</style>
